home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-09 | 919 b | 31 lines | [TEXT/Mrls] |
- module: dylan-user
- author: Patrick C. Beard <beard@cs.ucdavis.edu>
- synopsis: short demo of random module.
- copyright: Copyright (C) 1994, Patrick C. Beard. All rights reserved.
-
- //
- // random-test.dyl
- //
- // before running this file, load "Random.dyl" from the Marlais menu.
- //
-
- begin
- // set-module(Random); // so we can use the Random module.
-
- local method test-dist(dist :: <random-distribution>)
- princ(object-class(dist));
- for (i from 1 to 10)
- princ(random(dist));
- end for;
- end test-dist;
-
- test-dist(make(<unit-uniform-distribution>));
- test-dist(make(<real-uniform-distribution>, from: 1.0, to: 10.0));
- test-dist(make(<integer-uniform-distribution>, from: 1, to: 10));
- test-dist(make(<exponential-distribution>));
- test-dist(make(<normal-distribution>));
-
- princ("computing chi square of integer distribution from 1 to 10.");
- chi-square(make(<integer-uniform-distribution>, from: 1, to: 10));
- end;
-